<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <!-- 引入组件库 -->
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
    <script src="../plugins/echarts/echarts.js"></script>
    <style>
        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }
        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
        }
        .avatar {
            width: 178px;
            height: 178px;
            display: block;
        }
        .datatable {
            position: relative;
            box-sizing: border-box;
            -webkit-box-flex: 1;
            width: 100%;
            max-width: 100%;
            font-size: 14px;
            color: rgb(96, 98, 102);
            overflow: hidden;
            flex: 1 1 0%;
        }
        .datatable td, .datatable th {
            padding: 12px 0;
            min-width: 0;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            text-overflow: ellipsis;
            vertical-align: middle;
            position: relative;
            text-align: left;
        }
    </style>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>每日预约、到诊数量</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>每日预约、到诊数量</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <div class="filter-container">
                <el-date-picker
                        value-format="yyyy-MM-dd"
                        v-model="value"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                </el-date-picker>
                <el-button @click="findOrderDay()" class="dalfBut">查询</el-button>
            </div>
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>
        </div>
    </div>
</div>
</div>
</body>

<script>
    var vue = new Vue({
        el: '#app',
        data:{
            value:null
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            axios.get("/report/getOrderReport.do").then((res)=> {
                myChart1.setOption(
                    {
                        title: {
                            text: '后管数据统计(一)'
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        legend: {
                            data: ['每日预约数', '每日已到诊数','每日未到诊数']
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '3%',
                            containLabel: true
                        },
                        toolbox: {
                            feature: {
                                saveAsImage: {}
                            }
                        },
                        xAxis: {
                            type: 'category',
                            boundaryGap: false,
                            data: res.data.data.months
                        },
                        yAxis: {
                            type: 'value'
                        },
                        series: [{
                            name: '每日预约数',
                            type: 'line',
                            data: res.data.data.orderCount
                        }, {
                            name: '每日已到诊数',
                            type: 'line',
                            data: res.data.data.orderStatusCount
                        }, {
                            name: '每日未到诊数',
                            type: 'line',
                            data: res.data.data.notOrderStatusCount
                        }]
                    });
            });
        },
        methods: {
            //根据时间段查询每日预约，每日到诊数
            findOrderDay() {
                axios.post("/report/getOrderDayReport.do?value="+this.value).then((res)=>{
                    myChart1.setOption(
                        {
                            title: {
                                text: '后管数据统计(一)'
                            },
                            tooltip: {
                                trigger: 'axis'
                            },
                            legend: {
                                data: ['每日预约数', '每日已到诊数','每日未到诊数']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: res.data.data.months
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: [{
                                name: '每日预约数',
                                type: 'line',
                                data: res.data.data.orderCount
                            }, {
                                name: '每日已到诊数',
                                type: 'line',
                                data: res.data.data.orderStatusCount
                            }, {
                                name: '每日未到诊数',
                                type: 'line',
                                data: res.data.data.notOrderStatusCount
                            }]
                        });
                });
            }
        }
    });
    // 基于准备好的dom，初始化echarts实例
    var myChart1 = echarts.init(document.getElementById('chart1'));
</script>
</html>



